#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    // 构造方式
    string S1("hello 张三");
    string S2(S1);
    string S3(5, 'a');

    cout << "S1 = " << S1 << endl;
    cout << "S2 = " << S2 << endl;
    cout << "S3 = " << S3 << endl;

    S3 = "李四";
    cout << "S3 = " << S3 << endl;
    S1.insert(6, S3);
    cout << "S1 = " << S1 << endl;

    S1 += S3;
    cout << "S1 = " << S1 << endl;

    cout << "李四第一次出现在 :" << S1.find(S3, 0) << endl;

    if (!S1.compare(S3))
    {
        cout << "相同" << endl;
    }
    else
    {
        cout << "不相同" << endl;
    }
    S1 = "123456";
    // cin >> S1;
    int val = stoi(S1);
    cout << val << endl;
    cout << typeid(stoi(S1)).name() << endl;

    cout << S1[2] << endl;

    return 0;
}
